package days48;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class day23 {

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while (scanner.hasNext()) {
            int n=scanner.nextInt();
            int a=scanner.nextInt();
            for (int i = 0; i < n; i++) {
                int b=scanner.nextInt();
                if(b<a||b==a){
                    a+=b;
                }else {
                    a+= Max_approximation( a,  b);
                }
            }
            System.out.println(a);
        }

    }

    private static int Max_approximation(int a, int b) {
        int d = 1;
        while (d!=0)
        {
            d = a % b;
            a = b;
            b = d;
        }
        return a;
    }

    public static void main1(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String str=scanner.nextLine();
        HashMap<Character,Integer>map=new HashMap<>();
        for (int i = 0; i < str.length(); i++) {
            if(!map.containsKey(str.charAt(i))){
                map.put(str.charAt(i),1);
            }else {
                int k=map.get(str.charAt(i))+1;
                map.put(str.charAt(i),k);
            }
        }
        for (int i = 0; i < str.length(); i++) {
            if(map.get(str.charAt(i))==1){
                System.out.println(str.charAt(i));
                return;
            }
        }
        System.out.println(-1);
    }
}
